<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>当键盘按下时</title>
		<script src="js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<input type="text" id="" value="" />
		<p></p>
	</body>
</html>
<script type="text/javascript">
	$(document).ready(()=>{
		let i=0
		$("input").keypress(()=>{
			$("p").text(++i)
		})
	})
</script>